<template>
  <div class="user-card flex flex_column flex_center transition_0_3"
    :style="`background-color:${backgroundColor};`"
  >
    <div class="user-card__img" :style="{
      width:imgWidth,
      height:imgHeight,
      backgroundImage:`url(${img})`
    }">
      <!-- <img :src="img" alt="" /> -->
    </div>
    <div class="user-card__info flex_1 flex flex_column flex_center">
      <h2 class="user-card__title">{{ title }}</h2>
      <div class="user-card__content flex_2 mt_10" v-html="content"></div>
      <div class="user-card__button flex_1 m_10 mt_20">
        <ShadowBox  width="200px" height="40px" borderWidth="4px" plain center btn style="user-select:none;cursor: pointer;" 
        :bindClick="goto"
        >
          &gt;&gt; 进入个人主页 &lt;&lt;
        </ShadowBox>
      </div>
    </div>
  </div>
</template>

<script>
import ShadowBox from "../components/shadowBox.vue";
export default {
  name: "UserCard",
  components:{
    ShadowBox
  },
  props: {
    title: {
      type: String,
      default: "",
    },
    content: {
      type: String,
      default: "",
    },
    img: {
      type: String,
      default: "",
    },
    link: {
      type: String,
      default: "",
    },
    imgWidth: {
      type: String,
      default: "160px",
    },
    imgHeight: {
      type: String,
      default: "160px", 
    },
    backgroundColor: {
      type: String,
      default: "rgba(0,0,0,0)",
    },
  },
  data() {
    return {};
  },
  methods:{
    goto(){
      this.$router.push('/home');
    }
  }
};
</script>

<style lang="scss" scoped>
@import "../style/theme.scss";
.user-card {
  width: 100%;
  height: 100%;
  color:#333;
  .user-card__img {
    margin: 40px auto 10px;
    width: 100px;
    height: 100px;
    border-radius: 100%;
    overflow: hidden;
    border:4px solid #fff;
    // object-fit: cover;
    background-size: cover;
    // img {
    //   width: 100%;
    //   height: 100%;
      
    // }
  }
  .user-card__info{
    width: 100%;

    .user-card__title{
      color: $blue-500;
    }
    .user-card__content{
      background: rgba(0,0,0,0.2);
      color: #fff;
      text-align: center;
      width: 80%;
      height: 80px;
      overflow: auto;
      border-radius: 10px;
      padding: 20px;
    }
  }
}
</style>